import QtQuick 2.12
import QtQuick.Controls 2.5
//import QtQuick.VirtualKeyboard 2.4

ApplicationWindow {
    id: window
    visible: true
    width: 640
    height: 480
    title: qsTr("Tabs")


    Component.onCompleted: showMaximized()

//    BtnMenu {
//        id: bm
//        z: 2
//        anchors.right: parent.right
//        anchors.bottom: parent.bottom
//        anchors.bottomMargin: 7
//        anchors.rightMargin: 7

//        onSigIndex: {
//            swipeView.currentIndex = index
//        }

//        onSigActivated: {
//            if (b) {
//                swipeView.opacity = 0.2
//            } else {
//                swipeView.opacity = 1.0
//            }
//        }
//    }

    Sider {
        id: siderMenu
        anchors.left: parent.left
        anchors.leftMargin: 5
        anchors.verticalCenter: parent.verticalCenter
        z:10

        onSigBtnClicked: {
            if (code === "喂食") {
                swipeView.currentIndex = 0
                feed.reloadFeedInfo()
            } else if (code === "设置") {
                swipeView.currentIndex = 1
            } else if (code === "统计") {
                swipeView.currentIndex = 2
            }
        }
    }

    SwipeView {
        id: swipeView
        anchors.fill: parent
        interactive: false

        Behavior on opacity { PropertyAnimation { duration: 150}}

        Page1Form {
            id: feed
        }

        Page2Form {
            id: setting
        }

        Page3Form {
            id: statistic
        }
    }


//    InputPanel {
//        id: inputPanel
//        z: 99
//        x: 0
//        y: window.height
//        width: window.width

//        states: State {
//            name: "visible"
//            when: inputPanel.active
//            PropertyChanges {
//                target: inputPanel
//                y: window.height - inputPanel.height
//            }
//        }
//        transitions: Transition {
//            from: ""
//            to: "visible"
//            reversible: true
//            ParallelAnimation {
//                NumberAnimation {
//                    properties: "y"
//                    duration: 250
//                    easing.type: Easing.InOutQuad
//                }
//            }
//        }
//    }
}
